// 物流信息管理相关API
import request from '../utils/request'

// 获取物流信息列表
export const getLogisticsList = (params) => {
  return request({
    url: '/api/logistics',
    method: 'get',
    params
  })
}

// 获取物流详情
export const getLogisticsDetail = (id) => {
  return request({
    url: `/api/logistics/${id}`,
    method: 'get'
  })
}

// 更新物流状态
export const updateLogisticsStatus = (id, status) => {
  return request({
    url: `/api/logistics/${id}/status`,
    method: 'put',
    data: { status }
  })
}

// 更新物流信息
export const updateLogistics = (id, data) => {
  return request({
    url: `/api/logistics/${id}`,
    method: 'put',
    data
  })
}

// 获取物流轨迹
export const getLogisticsRoutes = (id) => {
  return request({
    url: `/api/logistics/${id}/routes`,
    method: 'get'
  })
}

// 添加物流轨迹
export const addLogisticsRoute = (id, route) => {
  return request({
    url: `/api/logistics/${id}/routes`,
    method: 'post',
    data: route
  })
}

// 删除物流信息
export const deleteLogistics = (id) => {
  return request({
    url: `/api/logistics/${id}`,
    method: 'delete'
  })
}